//
//  WLUserInfo.m
//  WanLian
//
//  Created by muzhuang on 2018/9/20.
//  Copyright © 2018年 wanlian. All rights reserved.
//

#import "WLUserInfo.h"

@implementation WLUserInfo

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.birthday = [aDecoder decodeObjectForKey:@"birthday"];
        self.email = [aDecoder decodeObjectForKey:@"email"];
        self.enable = [aDecoder decodeBoolForKey:@"enable"];
        self.headImg = [aDecoder decodeObjectForKey:@"headImg"];
        self.userid = [aDecoder decodeIntegerForKey:@"userid"];
//        self.lastLoginTime = [aDecoder decodeDoubleForKey:@"lastLoginTime"];
//        self.lastUpdateTime = [aDecoder decodeDoubleForKey:@"lastUpdateTime"];
        self.phone = [aDecoder decodeObjectForKey:@"phone"];
        self.remark = [aDecoder decodeObjectForKey:@"remark"];
        self.sex = [aDecoder decodeObjectForKey:@"sex"];
//        self.upassword = [aDecoder decodeObjectForKey:@"upassword"];
        self.username = [aDecoder decodeObjectForKey:@"username"];
        self.sessionId = [aDecoder decodeObjectForKey:@"sessionId"];
        self.devCount = [aDecoder decodeIntegerForKey:@"devCount"];
        self.userTag = [aDecoder decodeObjectForKey:@"userTag"];
        self.intAccount = [aDecoder decodeObjectForKey:@"intAccount"];
        self.sord = [aDecoder decodeObjectForKey:@"sord"];
        self.devicekey = [aDecoder decodeObjectForKey:@"devicekey"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
//    [self mj_encode:aCoder];
    [aCoder encodeObject:self.birthday forKey:@"birthday"];
    [aCoder encodeObject:self.email forKey:@"email"];
    [aCoder encodeBool:self.enable forKey:@"enable"];
    [aCoder encodeInteger:self.userid forKey:@"userid"];
    [aCoder encodeObject:self.headImg forKey:@"headImg"];
//    [aCoder encodeDouble:self.lastLoginTime forKey:@"lastLoginTime"];
//    [aCoder encodeDouble:self.lastUpdateTime forKey:@"lastUpdateTime"];
    [aCoder encodeObject:self.phone forKey:@"phone"];
    [aCoder encodeObject:self.remark forKey:@"remark"];
    [aCoder encodeObject:self.sex forKey:@"sex"];
//    [aCoder encodeObject:self.upassword forKey:@"upassword"];
    [aCoder encodeObject:self.username forKey:@"username"];
    [aCoder encodeObject:self.sessionId forKey:@"sessionId"];
    [aCoder encodeInteger:self.devCount forKey:@"devCount"];
    [aCoder encodeObject:self.userTag forKey:@"userTag"];
    [aCoder encodeObject:self.intAccount forKey:@"intAccount"];
    [aCoder encodeObject:self.sord forKey:@"sord"];
    [aCoder encodeObject:self.devicekey forKey:@"devicekey"];
}

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{@"userid":@"id"};
}

- (id)initWithDictionary:(NSDictionary *)dic
{
    if (self = [super init])
    {
        self.birthday = dic[@"birthday"];
        self.email = dic[@"email"];
        self.enable = [dic[@"enable"] boolValue];
        self.userid = [dic[@"id"] integerValue];
        self.headImg = dic[@"headImg"];
//        self.lastLoginTime = [dic[@"lastLoginTime"] doubleValue];
//        self.lastUpdateTime = [dic[@"lastUpdateTime"] doubleValue];
        self.phone = dic[@"phone"];
        self.remark = dic[@"remark"];
        self.sex = dic[@"sex"];
//        self.upassword = dic[@"upassword"];
        self.username = dic[@"username"];
        self.sessionId = dic[@"sessionId"];
        self.devCount = [dic[@"devCount"] integerValue];
        self.userTag = dic[@"userTag"];
        self.intAccount = dic[@"intAccount"];
        self.sord = dic[@"sord"];
        self.devicekey = dic[@"devicekey"];
    }
    return self;
}

@end
